//
//  TiXianViewController.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/8/9.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "TiXianViewController.h"

@interface TiXianViewController ()

@property (nonatomic, strong) NSMutableArray *btnArray;
@property (nonatomic, assign) NSInteger selectIndex;

@end

@implementation TiXianViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = UIColorWhite;
    [self loadBaseTitleLable:@"资金提现"];
    
    [self setUpUI];
}
- (void)setUpUI
{
    UIButton *btn1 = [UIButton buttonWithTitle:@"所有记录" fontSize:13 titleColor:UIColorWhite background:UIColorFromRGB(0xfbc865) cornerRadius:0];
    btn1.layer.borderWidth = 0.5;
    btn1.layer.borderColor = globalGray.CGColor;
    [self.view addSubview:btn1];
    [btn1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.top.equalTo(self.view).offset(SafeAreaTopHeight);
        make.size.mas_offset(CGSizeMake(kScreenWidth/4, rateHeight(90)));
    }];
    btn1.tag = 1;
    [btn1 addTarget:self action:@selector(actionSelect:) forControlEvents:(UIControlEventTouchUpInside)];
    
    UIButton *btn2 = [UIButton buttonWithTitle:@"申请提现" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:UIColorFromRGB(0xf5f5f5) cornerRadius:0];
    btn2.layer.borderWidth = 0.5;
    btn2.layer.borderColor = globalGray.CGColor;
    [self.view addSubview:btn2];
    [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(btn1.mas_right);
        make.top.equalTo(self.view).offset(SafeAreaTopHeight);
        make.size.mas_offset(CGSizeMake(kScreenWidth/4, rateHeight(90)));
    }];
    btn2.tag = 2;
    [btn2 addTarget:self action:@selector(actionSelect:) forControlEvents:(UIControlEventTouchUpInside)];
    
    UIButton *btn3 = [UIButton buttonWithTitle:@"提现失败" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:UIColorFromRGB(0xf5f5f5) cornerRadius:0];
    btn3.layer.borderWidth = 0.5;
    btn3.layer.borderColor = globalGray.CGColor;
    [self.view addSubview:btn3];
    [btn3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(btn2.mas_right);
        make.top.equalTo(self.view).offset(SafeAreaTopHeight);
        make.size.mas_offset(CGSizeMake(kScreenWidth/4, rateHeight(90)));
    }];
    btn3.tag = 3;
    [btn3 addTarget:self action:@selector(actionSelect:) forControlEvents:(UIControlEventTouchUpInside)];
    
    UIButton *btn4 = [UIButton buttonWithTitle:@"提现成功" fontSize:13 titleColor:UIColorFromRGB(0x909090) background:UIColorFromRGB(0xf5f5f5) cornerRadius:0];
    btn4.layer.borderWidth = 0.5;
    btn4.layer.borderColor = globalGray.CGColor;
    [self.view addSubview:btn4];
    [btn4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(btn3.mas_right);
        make.top.equalTo(self.view).offset(SafeAreaTopHeight);
        make.size.mas_offset(CGSizeMake(kScreenWidth/4, rateHeight(90)));
    }];
    btn4.tag = 4;
    [btn4 addTarget:self action:@selector(actionSelect:) forControlEvents:(UIControlEventTouchUpInside)];
    
    self.btnArray = [NSMutableArray array];
    [self.btnArray addObject:btn1];
    [self.btnArray addObject:btn2];
    [self.btnArray addObject:btn3];
    [self.btnArray addObject:btn4];
}
- (void)actionSelect:(UIButton *)btn
{
    self.selectIndex = btn.tag;
    for (UIButton *btn1 in self.btnArray) {
        if (btn1.tag != btn.tag) {
            [btn1 setBackgroundImage:[UIImage createImageWithColor:UIColorFromRGB(0xf5f5f5)] forState:UIControlStateNormal];
            [btn1 setTitleColor:UIColorFromRGB(0x909090) forState:(UIControlStateNormal)];
        } else {
            [btn1 setBackgroundImage:[UIImage createImageWithColor:UIColorFromRGB(0xfbc865)] forState:UIControlStateNormal];
            [btn1 setTitleColor:UIColorWhite forState:(UIControlStateNormal)];
        }
    }
//    [self getGoodsListData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
